<!DOCTYPE html>
<html>
  <title>v-for遍历</title>
  <script src="../../js/vue.js"></script>
  <head>
    <meta charset="utf-8" />
  </head>
  <body>
    <div id="div1">
      <ul>
        <!-- v-for遍历数组，可以通过元组获取下表索引值 -->
        <li v-for="(name, idx) in names">{{idx+1}}: {{name}}</li>
      </ul>
      <---------------->
      <ul>
        <!-- v-for遍历对象，可以通过元组获取value-key-index，如果只有一个值时，默认是value -->
        <li v-for="(val, key, idx) in info">
          {{idx+1}}: {{key}}-{{val}}
        </li>
      </ul>
    </div>
  </body>
  <script>
    const app = new Vue({
      el: "#div1",
      data: {
        names: ["sherman", "wqy", "tl", "gantlei"],
        info: {
          name: "sherman",
          age: 23,
          height: 1.76
        }
      }
    });
  </script>
</html>
